Normal Distribution
参数: $\mu$ (均值), $\sigma^2$ (方差)
Probability density function (PDF):
Cumulative Distribution Function (CDF):
正态分布的CDF没有初等函数的封闭解析式。
Expectation:
Variance:
Moments:
$(n-1)!! = (n-1)(n-3)\cdots 3 \cdot 1$ 是双阶乘
Moment generating function:
Definition:
For $\mu \in \mathbb{R}$ and $\sigma > 0$, we call a distribution with the density function
the normal distribution $N(\mu, \sigma^2)$.
For $\mu = 0$ and $\sigma^2 = 1$, this reduces to the density
of the standard normal distribution $N(0, 1)$.
Theorem:
For $\mu \in \mathbb{R}$ and $\sigma > 0$, the function
is indeed a density function.
Proof: Using the substitution $y = \frac{x - \mu}{\sigma}$, so that $dx = \sigma \, dy$, we have:
where
Note that this integral exists. Consider:
We switch to polar coordinates, i.e., we substitute
We compute the Jacobian determinant:
So we obtain:
Substitute $u = \frac{r^2}{2}$, so that $du = r \, dr$:
Hence, we conclude:
.$\square$
Theorem: Let $X \sim N(\mu,\sigma^2)$ be a random variable, then
Proof:
Expectation:
Substitute $z = \frac{x - \mu}{\sigma} \Rightarrow x = \sigma z + \mu$, and $dx = \sigma dz$:
First notice that $z \cdot e^{-z^2/2}$ is an odd function. Since
we have
(Do keep in mind: if $f$ is an odd function, then
is a necessary condition of $\int_{\infty}^{\infty}f(x)dx = 0$ . Because otherwise, $f(x)=x$ is a simple counterexample.)
Moreover, we have seen in the last proof that
Therefore,
Variance:
We compute:
Again substitute $z = \frac{x - \mu}{\sigma} \Rightarrow x = \sigma z + \mu$, and $dx = \sigma dz$:
,where
In addition, since $\phi’(z) = z\phi(z)$,
Finally, we have
.$\square$
Bernoulli Distribution 伯努利分布
参数: $p$ (成功概率, $0 \le p \le 1$)
Probability mass function (PMF):
Cumulative Distribution Function (CDF):
Expectation:
Variance:
Moments:
Moment generating function:
Binomial Distribution 二项分布
参数: $n$ (试验次数), $p$ (成功概率)
Probability mass function (PMF):
Cumulative Distribution Function (CDF):
Expectation:
Variance:
Moments:
Moment generating function:
Poisson Distribution 泊松分布
参数: $\lambda$ (单位时间/面积内的平均发生率, $\lambda > 0$)
Probability mass function (PMF):
Cumulative Distribution Function (CDF):
Expectation:
Variance:
Moments:
Moment generating function:
Geometric Distribution 几何分布
参数: $p$ (成功概率)。此处定义为第 $k$ 次试验首次成功 (Support: $1, 2, \dots$)
Probability mass function (PMF):
Cumulative Distribution Function (CDF):
Expectation:
Variance:
Moments:
涉及到多重对数函数,无简单的初等函数通项。通常使用递推公式:
Moment generating function:
Uniform Distribution 均匀分布
参数: $a, b$ (区间端点, $a < b$)
Probability density function (PDF):
Cumulative Distribution Function (CDF):
Expectation:
Variance:
Moments:
Moment generating function:
Exponential Distribution 指数分布
参数: $\lambda$ (率参数, $\lambda > 0$)
Probability density function (PDF):
Cumulative Distribution Function (CDF):
Expectation:
Variance:
Moments:
Moment generating function:
Gamma Distribution 伽玛分布
参数: $\alpha$ (形状参数 shape), $\beta$ (率参数 rate, sometimes $\theta = 1/\beta$ is used as scale)
Probability density function (PDF):
Cumulative Distribution Function (CDF):
其中 $\gamma(s, x) = \int_0^x t^{s-1} e^{-t} dt$。
Expectation:
Variance:
Moments:
Moment generating function:
Chi-Squared Distribution 卡方分布
参数: $k$ (自由度 degrees of freedom, $k \in \mathbb{N}^*$)
卡方分布是伽玛分布的一个特例,其中$\alpha = k/2$, $\beta = 1/2$。
Probability density function (PDF):
Cumulative Distribution Function (CDF):
其中 $\gamma(s, x)$ 为下不完全伽玛函数,$P$ 为正则化伽玛函数。
Expectation:
Variance:
Moments:
Moment generating function:
Beta Distribution 贝塔分布
参数: $\alpha, \beta$ (形状参数 shape parameters, $\alpha > 0, \beta > 0$)
Probability density function (PDF):
其中 $B(\alpha, \beta) = \frac{\Gamma(\alpha)\Gamma(\beta)}{\Gamma(\alpha+\beta)}$ 为贝塔函数。
Cumulative Distribution Function (CDF):
其中 $B(x; \alpha, \beta) = \int_0^x t^{\alpha-1}(1-t)^{\beta-1} dt$ 为不完全贝塔函数 (Incomplete Beta Function),$I_x$ 为正则化不完全贝塔函数。
Expectation:
Variance:
Moments:
Moment generating function:
无初等函数形式,通常表示为合流超几何函数 (Confluent Hypergeometric Function):
R
在 R 语言中,处理概率分布有一套非常标准的前缀命名规则。对于每种分布(比如 norm),都有 4 个核心函数:
d(Density): 概率密度/质量函数 (PDF/PMF), e.g.,dnormp(Probability): 累积分布函数 (CDF), e.g.,pnormq(Quantile): 分位数函数 (CDF 的反函数), e.g.,qnormr(Random): 生成随机数, e.g.,rnorm
一、离散型分布 (Discrete)
1. Bernoulli & Binomial (伯努利与二项分布)
R 中没有专门的 bernoulli 函数,伯努利分布就是 size = 1 的二项分布。
1 | # 参数设定: n=10次试验, p=0.5成功率 |
2. Poisson Distribution (泊松分布)
1 | # 参数设定: lambda = 4 |
3. Geometric Distribution (几何分布)
R 中的几何分布定义为失败次数 ($X \in \{0, 1, \dots\}$),直到第一次成功。
- 如果使用的是 $X \in \{1, 2, \dots\}$ (第 $k$ 次首次成功),则 R 中的
x应该是k-1。
1 | # 参数: p = 0.2 |
二、连续型分布 (Continuous)
4. Uniform Distribution (均匀分布)
1 | # 参数: 区间 [a, b] -> min=0, max=10 |
5. Exponential Distribution (指数分布)
1 | # 参数: lambda (rate) = 0.5 |
6. Normal Distribution (正态分布)
注意:R 使用标准差 sd ($\sigma$) 作为参数,而不是方差 ($\sigma^2$)。
1 | # 参数: mean=0, sd=1 (标准正态) |
7. Gamma Distribution (伽玛分布)
R 支持 rate ($\beta$) 或 scale ($1/\beta$) 参数。
1 | # 参数: alpha (shape) = 2, beta (rate) = 0.5 |